package com.yj.change.adapter;

import com.yj.change.R;
import com.yj.change.data.MyAppInfo;
import com.yj.change.db.HookDB;

public class AppListAdapter extends ListAdapter<MyAppInfo> {

    @Override
    protected void bindData(Holder holder, int postion) {
        MyAppInfo info = getItem(postion);
        boolean isHook = HookDB.getIntance().readHookApps().contains(info.getPackageName());

        holder.setText(R.id.tvAppName, info.getAppName()).setTextColor(isHook?0xffff0000:0xff333333);
        holder.setText(R.id.tvAppVersion, info.getVersionName()).setTextColor(isHook?0xffff0000:0xff333333);
        holder.setText(R.id.tvAppPageName, info.getPackageName()).setTextColor(isHook?0xffff0000:0xff333333);
        holder.setImageDrawable(R.id.ivAppIcon, info.getImage());
    }

    @Override
    protected int getLayout() {
        return R.layout.item_app;
    }


}
